<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <select>
        <option>红色</option>
        <option>蓝色</option>
    </select>
    <div class="content">
        当选中select上的标签 将content中的内容设置为指定的颜色
    </div>
    <script>
        // 当选中select上的标签 将content中的内容设置为指定的颜色
        var selectDom =document.querySelectorAll('select>option');

        var contentDom = document.querySelector('.content');
        console.log(contentDom)
            for(var i = 0; i<selectDom.length;i++){
                selectDom[i].value = i

                document.querySelector('select').onchange =function(){                    
                if(this.value == 0){
                    contentDom.style.color = 'red';
                }else{
                    contentDom.style.color = 'blue';
                }
            }
               
        }
    </script>
</body>
</html>